#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
	int i = 0;
	for (i = 10000; i <= 99999; i++)
	{
		int j = 0;
		int sum = 0;
		for (j = 1; j <= 4; j++)
		{
			int m = i % ((int)pow(10, j));
			int n = i / (pow(10, j));
			sum+=m*n;

		}
		if (i == sum)
		{
			printf("%d ", i);
		}
		

	}
	return 0;
}